# Replication Archive for: 
# Coppock, Alexander and Donald P. Green. 2020. 
# "Do Belief Systems Exhibit Dynamic Constraint?" 
# The Journal of Politics, Forthcoming.

rm(list = ls())
library(tidyverse)
library(estimatr)
library(stargazer)

original <- read_rds("data/clean/original_trump_white_clean.rds")
replication <-
  read_rds("data/clean/replication_trump_white_clean.rds")


fit_1 <- lm(tw_manip_1 ~ tw_Z, data = original)
fit_2 <- lm(ESJ_s ~ tw_Z, data = original)

stargazer(fit_1, fit_2, 
          p = starprep(fit_1, fit_2, stat = "p.value"),
          se = starprep(fit_1, fit_2),
          dep.var.labels = c("Belief in Inequality", "Econ. System Justification"),
          covariate.labels = c("Inequality Treatment", "Constant (Control Mean)"),
          style = "apsr",
          column.sep.width = "0pt",
          omit.stat = c("f", "ser", "rsq", "adj.rsq"),
          star.cutoffs = c(0.05),
          label = "tab:ssm",
          notes = c("Robust standard errors are in parentheses."),
          font.size = "footnotesize",
          title = "Inequality Experimental Results",
          out = "../Drafts/tables/study_3.tex")



replication <-
  replication %>%
  mutate(tw_Z = factor(tw_Z, levels = c("control", "treatment", "pure_control")))
fit_1 <- lm(tw_manip_1 ~ tw_Z, data = replication)
fit_2 <- lm(ESJ_s ~ tw_Z, data = replication)

stargazer(fit_1, fit_2, 
          p = starprep(fit_1, fit_2, stat = "p.value"),
          se = starprep(fit_1, fit_2),
          dep.var.labels = c("Belief in Inequality", "Econ. System Justification"),
          covariate.labels = c("Inequality Treatment", "Pure control", "Constant (Control Mean)"),
          style = "apsr",
          column.sep.width = "0pt",
          omit.stat = c("f", "ser", "rsq", "adj.rsq"),
          star.cutoffs = c(0.05),
          label = "tab:ssm",
          notes = c("Robust standard errors are in parentheses."),
          font.size = "footnotesize",
          title = "Inequality Experimental Results",
          out = "../Drafts/tables/study_3_replication.tex")


